home *** CD-ROM | disk | FTP | other *** search
/ Developer CD Series 1999 April: Mac OS SDK / Dev.CD Apr 99 SDK1.toast / Development Kits / Interfaces&Libraries / Universal / Interfaces / AIncludes / Start.a < prev    next >
Encoding:
Text File  |  1998-08-17  |  11.5 KB  |  351 lines  |  [TEXT/MPS ]

  1. ;
  2. ;    File:        Start.a
  3. ;
  4. ;    Contains:    Start Manager Interfaces.
  5. ;
  6. ;    Version:    Technology:    System 7.5
  7. ;                Release:    Universal Interfaces 3.2
  8. ;
  9. ;    Copyright:    © 1987-1993, 1996-1998 by Apple Computer, Inc., all rights reserved
  10. ;
  11. ;    Bugs?:        For bug reports, consult the following page on
  12. ;                the World Wide Web:
  13. ;
  14. ;                    http://developer.apple.com/bugreporter/
  15. ;
  16. ;
  17.     IF &TYPE('__START__') = 'UNDEFINED' THEN
  18. __START__ SET 1
  19.  
  20.     IF &TYPE('__MACTYPES__') = 'UNDEFINED' THEN
  21.     include 'MacTypes.a'
  22.     ENDIF
  23.     IF &TYPE('__FILES__') = 'UNDEFINED' THEN
  24.     include 'Files.a'
  25.     ENDIF
  26.  
  27. ;    Important: When the major version number of kExtensionTableVersion and the value
  28. ;    returned by gestaltExtensionTableVersion change, it indicates that the Extension
  29. ;    Table startup mechanism has radically changed and code that doesn't know about
  30. ;    the new major version must not attempt to use the Extension Table startup
  31. ;    mechanism.
  32. ;    
  33. ;    Changes to the minor version number of kExtensionTableVersion indicate that the
  34. ;    definition of the ExtensionElement structure has been extended, but the fields
  35. ;    defined for previous minor versions of kExtensionTableVersion have not changed.
  36. ;
  37.  
  38.  
  39. kExtensionTableVersion            EQU        $00000100            ; current ExtensionTable version (1.0.0) 
  40. ;  ExtensionNotification message codes 
  41.  
  42. extNotificationBeforeFirst        EQU        0                    ; Before any extensions have loaded 
  43. extNotificationAfterLast        EQU        1                    ; After all extensions have loaded 
  44. extNotificationBeforeCurrent    EQU        2                    ; Before extension at extElementIndex is loaded 
  45. extNotificationAfterCurrent        EQU        3                    ; After extension at extElementIndex is loaded 
  46. ExtensionElement        RECORD 0
  47. fileName                 ds        Str31            ; offset: $0 (0)        ;  The file name 
  48. parentDirID                 ds.l    1                ; offset: $20 (32)        ;  the file's parent directory ID 
  49. ;  and everything after ioNamePtr in the HParamBlockRec.fileParam variant 
  50. ioVRefNum                 ds.w    1                ; offset: $24 (36)        ;  always the real volume reference number (not a drive, default, or working dirID) 
  51. ioFRefNum                 ds.w    1                ; offset: $26 (38)
  52. ioFVersNum                 ds.b    1                ; offset: $28 (40)
  53. filler1                     ds.b    1                ; offset: $29 (41)
  54. ioFDirIndex                 ds.w    1                ; offset: $2A (42)        ;  always 0 in table 
  55. ioFlAttrib                 ds.b    1                ; offset: $2C (44)
  56. ioFlVersNum                 ds.b    1                ; offset: $2D (45)
  57. ioFlFndrInfo             ds        FInfo            ; offset: $2E (46)
  58. ioDirID                     ds.l    1                ; offset: $3E (62)
  59. ioFlStBlk                 ds.w    1                ; offset: $42 (66)
  60. ioFlLgLen                 ds.l    1                ; offset: $44 (68)
  61. ioFlPyLen                 ds.l    1                ; offset: $48 (72)
  62. ioFlRStBlk                 ds.w    1                ; offset: $4C (76)
  63. ioFlRLgLen                 ds.l    1                ; offset: $4E (78)
  64. ioFlRPyLen                 ds.l    1                ; offset: $52 (82)
  65. ioFlCrDat                 ds.l    1                ; offset: $56 (86)
  66. ioFlMdDat                 ds.l    1                ; offset: $5A (90)
  67. sizeof                     EQU *                    ; size:   $5E (94)
  68.                         ENDR
  69. ; typedef struct ExtensionElement *        ExtensionElementPtr
  70.  
  71. ExtensionTableHeader    RECORD 0
  72. extTableHeaderSize         ds.l    1                ; offset: $0 (0)        ;  size of ExtensionTable header ( equal to offsetof(ExtensionTable, extElements[0]) ) 
  73. extTableVersion             ds.l    1                ; offset: $4 (4)        ;  current ExtensionTable version (same as returned by gestaltExtTableVersion Gestalt selector) 
  74. extElementIndex             ds.l    1                ; offset: $8 (8)        ;  current index into ExtensionElement records (zero-based) 
  75. extElementSize             ds.l    1                ; offset: $C (12)        ;  size of ExtensionElement 
  76. extElementCount             ds.l    1                ; offset: $10 (16)        ;  number of ExtensionElement records in table (1-based) 
  77. sizeof                     EQU *                    ; size:   $14 (20)
  78.                         ENDR
  79. ExtensionTable            RECORD 0
  80. extTableHeader             ds        ExtensionTableHeader ; offset: $0 (0)    ;  the ExtensionTableHeader 
  81. extElements                 ds        ExtensionElement ; offset: $14 (20) <-- really an array of length one ;  one element for each extension to load 
  82. sizeof                     EQU *                    ; size:   $72 (114)
  83.                         ENDR
  84. ; typedef struct ExtensionTable *        ExtensionTablePtr
  85.  
  86. ; typedef ExtensionTablePtr *            ExtensionTableHandle
  87.  
  88. DefStartRec                RECORD 0
  89. sdExtDevID                 ds.b    1                ; offset: $0 (0)
  90. sdPartition                 ds.b    1                ; offset: $1 (1)
  91. sdSlotNum                 ds.b    1                ; offset: $2 (2)
  92. sdSRsrcID                 ds.b    1                ; offset: $3 (3)
  93.                          ORG 0
  94. sdReserved1                 ds.b    1                ; offset: $0 (0)
  95. sdReserved2                 ds.b    1                ; offset: $1 (1)
  96. sdRefNum                 ds.w    1                ; offset: $2 (2)
  97. sizeof                     EQU *                    ; size:   $4 (4)
  98.                         ENDR
  99. ; typedef union DefStartRec *            DefStartPtr
  100.  
  101. DefVideoRec                RECORD 0
  102. sdSlot                     ds.b    1                ; offset: $0 (0)
  103. sdsResource                 ds.b    1                ; offset: $1 (1)
  104. sizeof                     EQU *                    ; size:   $2 (2)
  105.                         ENDR
  106. ; typedef struct DefVideoRec *            DefVideoPtr
  107.  
  108. DefOSRec                RECORD 0
  109. sdReserved                 ds.b    1                ; offset: $0 (0)
  110. sdOSType                 ds.b    1                ; offset: $1 (1)
  111. sizeof                     EQU *                    ; size:   $2 (2)
  112.                         ENDR
  113. ; typedef struct DefOSRec *                DefOSPtr
  114.  
  115. ;
  116. ; pascal void GetDefaultStartup(DefStartPtr paramBlock)
  117. ;
  118.     IF TARGET_OS_MAC ** TARGET_CPU_68K ** ¬ TARGET_RT_MAC_CFM THEN
  119.         ; parameters:
  120.         ;    paramBlock      => A0
  121.         _GetDefaultStartup:    OPWORD    $A07D
  122.     ELSEIF TARGET_OS_MAC ** TARGET_RT_MAC_CFM THEN
  123.         IMPORT_CFM_FUNCTION GetDefaultStartup
  124.     ENDIF
  125.  
  126. ;
  127. ; pascal void SetDefaultStartup(DefStartPtr paramBlock)
  128. ;
  129.     IF TARGET_OS_MAC ** TARGET_CPU_68K ** ¬ TARGET_RT_MAC_CFM THEN
  130.         ; parameters:
  131.         ;    paramBlock      => A0
  132.         _SetDefaultStartup:    OPWORD    $A07E
  133.     ELSEIF TARGET_OS_MAC ** TARGET_RT_MAC_CFM THEN
  134.         IMPORT_CFM_FUNCTION SetDefaultStartup
  135.     ENDIF
  136.  
  137. ;
  138. ; pascal void GetVideoDefault(DefVideoPtr paramBlock)
  139. ;
  140.     IF TARGET_OS_MAC ** TARGET_CPU_68K ** ¬ TARGET_RT_MAC_CFM THEN
  141.         ; parameters:
  142.         ;    paramBlock      => A0
  143.         _GetVideoDefault:    OPWORD    $A080
  144.     ELSEIF TARGET_OS_MAC ** TARGET_RT_MAC_CFM THEN
  145.         IMPORT_CFM_FUNCTION GetVideoDefault
  146.     ENDIF
  147.  
  148. ;
  149. ; pascal void SetVideoDefault(DefVideoPtr paramBlock)
  150. ;
  151.     IF TARGET_OS_MAC ** TARGET_CPU_68K ** ¬ TARGET_RT_MAC_CFM THEN
  152.         ; parameters:
  153.         ;    paramBlock      => A0
  154.         _SetVideoDefault:    OPWORD    $A081
  155.     ELSEIF TARGET_OS_MAC ** TARGET_RT_MAC_CFM THEN
  156.         IMPORT_CFM_FUNCTION SetVideoDefault
  157.     ENDIF
  158.  
  159. ;
  160. ; pascal void GetOSDefault(DefOSPtr paramBlock)
  161. ;
  162.     IF TARGET_OS_MAC ** TARGET_CPU_68K ** ¬ TARGET_RT_MAC_CFM THEN
  163.         ; parameters:
  164.         ;    paramBlock      => A0
  165.         _GetOSDefault:    OPWORD    $A084
  166.     ELSEIF TARGET_OS_MAC ** TARGET_RT_MAC_CFM THEN
  167.         IMPORT_CFM_FUNCTION GetOSDefault
  168.     ENDIF
  169.  
  170. ;
  171. ; pascal void SetOSDefault(DefOSPtr paramBlock)
  172. ;
  173.     IF TARGET_OS_MAC ** TARGET_CPU_68K ** ¬ TARGET_RT_MAC_CFM THEN
  174.         ; parameters:
  175.         ;    paramBlock      => A0
  176.         _SetOSDefault:    OPWORD    $A083
  177.     ELSEIF TARGET_OS_MAC ** TARGET_RT_MAC_CFM THEN
  178.         IMPORT_CFM_FUNCTION SetOSDefault
  179.     ENDIF
  180.  
  181. ;
  182. ; pascal void SetTimeout(short count)
  183. ;
  184.     IF TARGET_OS_MAC ** TARGET_CPU_68K ** ¬ TARGET_RT_MAC_CFM THEN
  185.         Macro
  186.         _SetTimeout
  187.             move.w              #$0001,A0
  188.             dc.w                $A07F
  189.         EndM
  190.     ELSEIF TARGET_OS_MAC ** TARGET_RT_MAC_CFM THEN
  191.         IMPORT_CFM_FUNCTION SetTimeout
  192.     ENDIF
  193.  
  194. ;
  195. ; pascal void GetTimeout(short *count)
  196. ;
  197.     IF TARGET_OS_MAC ** TARGET_CPU_68K ** ¬ TARGET_RT_MAC_CFM THEN
  198.         Macro
  199.         _GetTimeout
  200.             sub.l               A0,A0
  201.             dc.w                $A07F
  202.         EndM
  203.     ELSEIF TARGET_OS_MAC ** TARGET_RT_MAC_CFM THEN
  204.         IMPORT_CFM_FUNCTION GetTimeout
  205.     ENDIF
  206.  
  207. ;    InstallExtensionNotificationProc
  208. ;
  209. ;    Installs an ExtensionNotificationUPP.
  210. ;
  211. ;    Parameters:
  212. ;        extNotificationProc    The ExtensionNotificationUPP to install.
  213. ;
  214. ;    Results:
  215. ;        noErr        0        The ExtensionNotificationUPP was installed.
  216. ;        paramErr    -50        This ExtensionNotificationUPP has already been installed.
  217. ;        memFullErr    -108    Not enough memory to install the ExtensionNotificationUPP.
  218. ;
  219.  
  220. ;
  221. ; pascal OSErr InstallExtensionNotificationProc(ExtensionNotificationUPP extNotificationProc)
  222. ;
  223.     IF TARGET_OS_MAC ** TARGET_CPU_68K ** ¬ TARGET_RT_MAC_CFM THEN
  224.         Macro
  225.         _InstallExtensionNotificationProc
  226.             moveq               #0,D0
  227.             dc.w                $AA7D
  228.         EndM
  229.     ELSEIF TARGET_OS_MAC ** TARGET_RT_MAC_CFM THEN
  230.         IMPORT_CFM_FUNCTION InstallExtensionNotificationProc
  231.     ENDIF
  232.  
  233.  
  234. ;    RemoveExtensionNotificationProc
  235. ;
  236. ;    Removes an ExtensionNotificationUPP.
  237. ;    
  238. ;    Note:    ExtensionNotificationUPPs can't call RemoveExtensionNotificationProc.
  239. ;
  240. ;    Parameters:
  241. ;        extNotificationProc    The ExtensionNotificationUPP to remove.
  242. ;
  243. ;    Results:
  244. ;        noErr        0        The ExtensionNotificationUPP was removed.
  245. ;        paramErr    -50        The ExtensionNotificationUPP was not found, or
  246. ;                            RemoveExtensionNotificationProc was called from within
  247. ;                            a ExtensionNotificationUPP (ExtensionNotificationUPPs can't
  248. ;                            call RemoveExtensionNotificationProc).
  249. ;
  250.  
  251. ;
  252. ; pascal OSErr RemoveExtensionNotificationProc(ExtensionNotificationUPP extNotificationProc)
  253. ;
  254.     IF TARGET_OS_MAC ** TARGET_CPU_68K ** ¬ TARGET_RT_MAC_CFM THEN
  255.         Macro
  256.         _RemoveExtensionNotificationProc
  257.             moveq               #1,D0
  258.             dc.w                $AA7D
  259.         EndM
  260.     ELSEIF TARGET_OS_MAC ** TARGET_RT_MAC_CFM THEN
  261.         IMPORT_CFM_FUNCTION RemoveExtensionNotificationProc
  262.     ENDIF
  263.  
  264.  
  265. ;    InstallExtensionTableHandlerProc
  266. ;
  267. ;    Installs an ExtensionTableHandlerUPP. Control is taken away from the system's default
  268. ;    handler and the ExtensionTableHandlerUPP is responsible for all changes to the
  269. ;    ExtensionTable (except for incrementing extElementIndex between extensions). This is
  270. ;    always the first handler called with extNotificationBeforeFirst and
  271. ;    extNotificationBeforeCurrent messages and the last handler called with
  272. ;    extNotificationAfterLast and extNotificationAfterCurrent messages. extElementIndex
  273. ;    is always incremented immediately after the ExtensionTableHandlerUPP is called with
  274. ;    the extNotificationAfterCurrent message.
  275. ;    
  276. ;    There can only be one ExtensionTableHandler installed.
  277. ;    
  278. ;    Warning:    The only safe time to change what ExtensionElement is at
  279. ;                ExtensionTable.extElements[extElementIndex] is when your
  280. ;                ExtensionTableHandlerUPP is called with the extNotificationAfterCurrent
  281. ;                message. You may change the ExtensionTable or the extElementIndex at other
  282. ;                times, but you must ensure that the ExtensionElement at
  283. ;                ExtensionTable.extElements[extElementIndex] stays the same.
  284. ;                
  285. ;    Note:        If the ExtensionTable or the contents of the folders included in the
  286. ;                ExtensionTable are changed after installing an ExtensionTableHandler,
  287. ;                RemoveExtensionTableHandlerProc cannot be called.
  288. ;
  289. ;    Parameters:
  290. ;        extMgrProc            The ExtensionTableHandlerUPP to install.
  291. ;        extTable            A pointer to an ExtensionTableHandle where
  292. ;                            InstallExtensionTableHandlerProc will return the current
  293. ;                            ExtensionTableHandle. You don't own the handle itself and
  294. ;                            must not dispose of it, but you can change the extElementIndex.
  295. ;                            the extElementCount, and the ExtensionElements in the table.
  296. ;
  297. ;    Results:
  298. ;        noErr        0        The ExtensionTableHandlerUPP was installed.
  299. ;        paramErr    -50        Another ExtensionTableHandlerUPP has already been installed.
  300. ;        memFullErr    -108    Not enough memory to install the ExtensionTableHandlerUPP.
  301. ;
  302.  
  303. ;
  304. ; pascal OSErr InstallExtensionTableHandlerProc(ExtensionTableHandlerUPP extMgrProc, ExtensionTableHandle *extTable)
  305. ;
  306.     IF TARGET_OS_MAC ** TARGET_CPU_68K ** ¬ TARGET_RT_MAC_CFM THEN
  307.         Macro
  308.         _InstallExtensionTableHandlerProc
  309.             moveq               #2,D0
  310.             dc.w                $AA7D
  311.         EndM
  312.     ELSEIF TARGET_OS_MAC ** TARGET_RT_MAC_CFM THEN
  313.         IMPORT_CFM_FUNCTION InstallExtensionTableHandlerProc
  314.     ENDIF
  315.  
  316.  
  317. ;    RemoveExtensionTableHandlerProc
  318. ;
  319. ;    Remove an ExtensionTableUPP. Control is passed back to the default handler.
  320. ;
  321. ;    Parameters:
  322. ;        extMgrProc            The ExtensionTableUPP to remove.
  323. ;
  324. ;    Results:
  325. ;        noErr        0        The ExtensionTableUPP was removed.
  326. ;        paramErr    -50        This ExtensionTableUPP was not installed,
  327. ;                            or the ExtensionTable no longer matches the
  328. ;                            original boot ExtensionTable.
  329. ;
  330.  
  331. ;
  332. ; pascal OSErr RemoveExtensionTableHandlerProc(ExtensionTableHandlerUPP extMgrProc)
  333. ;
  334.     IF TARGET_OS_MAC ** TARGET_CPU_68K ** ¬ TARGET_RT_MAC_CFM THEN
  335.         Macro
  336.         _RemoveExtensionTableHandlerProc
  337.             moveq               #3,D0
  338.             dc.w                $AA7D
  339.         EndM
  340.     ELSEIF TARGET_OS_MAC ** TARGET_RT_MAC_CFM THEN
  341.         IMPORT_CFM_FUNCTION RemoveExtensionTableHandlerProc
  342.     ENDIF
  343.  
  344.     ENDIF ; __START__ 
  345.  
  346.